<?php


require_once "js/updatejob.php";


echo '<body><h3>Read-only Job</h3>';
$result = mysql_query("SELECT * FROM tbljobsarchive where LogNumber='$_GET[log]'");


$row = mysql_fetch_array($result);
$project=$row[Project];
echo '<form method="Post" Action="helpdesk/retrieve.php" id="jobForm" enctype="multipart/form-data">';
echo '<table width=100%><tr>';
echo '<td>Log : '.'<INPUT type="text" name="LogNumber" value ="'.$_GET[log].'" readonly>';
echo '</td>';
echo '<td>Operator :<p> '; echo $row['Operator'].'</td>' ;
echo '<td>Date : '; echo $row['Date'].'</td>';
echo '<td> Time : '; echo $row['Time'].'</td>';

echo '<tr><td>Requestor : <input type="text" name="requestor" value="'.$row['Requestor'].'"></td>';
echo '<td>Assigned to: <p><select name="assigned">';
echo '<option value="'.$row['Assigned'].'">'.$row['Assigned'].'</option>';
echo '<option>Not Assigned</option>';
genOperator();
echo '</td>';
echo '<td>Project:<br><Select name="project">';
echo '<option>'.$row['Project'].'</option>';
genProjects();
echo '</select></td><td>Email updates to :<br><input type="text" name="mailupdates" value="'.$row[mail].'" size="30"></td></tr>';

echo '<tr><td> Branch No : <p> <INPUT type="text" name="branch" size = 2 value="'.$row['Branch'].'"></td>  
          <td>Department:<p><INPUT type="text" name="department" value="'.$row['Department'].'"></td>
          <td> Phone: <p><INPUT type="text" name="phone" value="'.$row['Phone'].'"></td>
          <td>  VNC :<br> <INPUT type="text" name="vnc" size="15" maxlength="15" value='.$row['VNC'].'><a class=asd href="javascript:runApp(\'vncviewer '.$row['VNC'].'\',\'false\');"> <img src="img/vnc.png"></a></td></tr>';
echo '<tr><td><p> Due date : <p><INPUT type="text" name="due"  value='.$row['Due'].'></td>
          <td>Proirty:<p> <SELECT name="proirty"  Value='.$row['Proirty'].'>';
    echo '<option>'.$row[Proirty].'</option>';
    echo '<option></option>';
            genProirty();
    echo '</SELECT></td>
        <td><div id="statusdiv">Status :</div><p> <SELECT id="statusbox" name="status" value="'.$row['status'].'" >
            <option value="'.$row[Status].'">'.$row[Status].'</option>
                <option></option>';
                genStatus();
    echo '</SELECT></td>' ;
    echo '<td> Closed: <INPUT type="checkbox" name="closed" value="checked"'.$row['Closed'].'>
          <br>Private: <INPUT type="checkbox" name="private" value="checked"'.$row['Private'].'></td>';
echo '</TR>';

echo '<tr><td colspan="4">Screenshot :';
if($row['Screenshot']=='')
{
    echo '<br><input type="hidden" name="MAX_FILE_SIZE" value="1000000000">
Choose a file to upload: <input name="file" type="file"><br>

';
}
else
{
    echo '<a href="helpdesk/screenshots/'.$row[Screenshot].'" Target="_Blank">Open</a>';
}
echo '</td></tr>';

echo '<tr><td colspan=4>Documents';
$resultdoc = mysql_query("SELECT * FROM tblDocuments where LogNumber='$_GET[log]' ORDER BY `DocNumber` DESC");
while($row1 = mysql_fetch_array($resultdoc))
{
    
    
    echo '<br><a href="helpdesk/documents/'.$row1['Document'].'" Target="_Blank">'.$row1['Document'].'</a>';
    
}
if($row1['Document']=="")
    {
        echo '<br><input type="hidden" name="MAX_FILE_SIZE" value="1000000000">
Choose a file to upload: <input name="document" type="file"><br>

';
    }
echo '</td></TR>';

echo '<tr><td colspan=4>Subject: <textarea rows=1 cols =50 name="subject">'.$row['Subject'].'</textarea></td></tr>';
echo '<tr><td colspan=4>Problem : <br><textarea rows=15 cols=120 name="problem"  value="'.$row['Subject'].'" MultiLine="true">'.$row['Problem'].'</textarea></td></tr>';
echo '<tr><td colspan=4>Solution :<p>';
echo '<textarea rows=5 cols=120 name="solution" ></textarea></td></tr><tr><td><div id="times">Time Spent</div> </td><td><input type="text" name="times" value=""  size="5" />Mins</td><td><img src="img/mailu.jpg" onclick="location.href=\'helpdesk/mailu.php?log='.$row[LogNumber].'\'"></form></td></tr>';
$result = mysql_query("SELECT * FROM tblsolutionsarchive where LogNumber='$_GET[log]' ORDER BY `key` DESC");

echo '<table border=1 Width="100%"><tr><td>Date</td><td>Time</td><td>Operator</td><td>Solution</td><td>Time Spent</TD>';
while($row = mysql_fetch_array($result))
{
echo '<tr><td>'.$row['Date'].'</td><td>'.$row['Time'].'</td><td>'.$row['Operator'].'</td><td>'.nl2br($row['Solution']).'</td><td>'.$row['TimeS'].'</tr>';
$total=$row[TimeS]+$total;

}
echo'</table>';
echo '<b>Total Time : </b>'.$total.' Mins';
echo '<p><input type="submit" value="Retrieve" onClick="jobForm.submit()"></form>';

mysql_close();
?>

